import request from "@/utils/request.js";

const API = {
    SAVE_CLERK: '/clerk',
    DEL_CLERK_BY_ID: '/clerk',
    UPDATE_CLERK: '/clerk',
    PAGE_CLERK: '/clerk/page',
    DISABLE_CLERK: '/clerk/ban',
    LIST_CLERK_NAME: '/clerk/list/name',
    SELF_GET: '/clerk/self/get',
    SELF_UPDATE: '/clerk/self/update',
}

// 新增店员
export const reqSaveClerk = (requestParam) => request.post(API.SAVE_CLERK, requestParam)
// 删除店员
export const reqDeleteClerkById = (id) => request.delete(API.DEL_CLERK_BY_ID, {params: {id}});
// 更新店员
export const reqUpdateClerk = (requestParam) => request.put(API.UPDATE_CLERK, requestParam)
// 禁用 | 启用店员
export const reqDisableOrEnableClerk = (id, banFlag) => request.put(API.DISABLE_CLERK, null, {params: {id: id, banFlag: banFlag}})
// 分页查询店员
export const reqPageClerk = (pn, ps, storeId, name) => request.get(API.PAGE_CLERK, {params: {pn, ps, storeId, name}})
// 列出所有店员
export const reqNameList = () => request.get(API.LIST_CLERK_NAME)
export const reqSelfGet = () => request.get(API.SELF_GET)
export const reqSelfUpdate = (requestParam) => request.put(API.SELF_UPDATE, requestParam)
